Skip to content

fix(file-upload): re-upload same file and A11y improvements #722 - #723

Merged
airikej merged 5 commits into
rcfrom
fix/722-fileupload-behavioural-bugs
Jul 28, 2026
Merged

fix(file-upload): re-upload same file and A11y improvements #722#723
airikej merged 5 commits into
rcfrom
fix/722-fileupload-behavioural-bugs

Conversation

@airikej

@airikej airikej commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Improved FileUpload accessibility with clearer screen-reader announcements, helper-text associations, and descriptive remove controls.
    • Added focus management after removing or clearing files.
    • File inputs can now be reselected with the same file, and repeated announcements are reliably announced.
    • Added localized messages for removed and cleared files.
    • Added support for customizing Tag accessibility roles.
  • Bug Fixes

    • Improved keyboard focus visibility for file uploads.
    • Fixed announcement handling for successful, rejected, removed, and cleared files.
  • Documentation

    • Marked the Community FileUpload as deprecated and directed users to the TEDI-Ready version.

@airikej airikej linked an issue Jul 3, 2026 that may be closed by this pull request
21 tasks
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d79b131-ec88-431f-8dd1-e4a1296e164b

📥 Commits

Reviewing files that changed from the base of the PR and between 04ca935 and 55535fa.

📒 Files selected for processing (6)
  • skills/tedi-react/references/components.md
  • src/community/components/form/file-upload/file-upload.tsx
  • src/tedi/components/form/file-upload/file-upload.spec.tsx
  • src/tedi/components/form/file-upload/file-upload.tsx
  • src/tedi/helpers/hooks/use-file-upload.ts
  • src/tedi/providers/label-provider/labels-map.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • skills/tedi-react/references/components.md
  • src/community/components/form/file-upload/file-upload.tsx
  • src/tedi/providers/label-provider/labels-map.ts
  • src/tedi/components/form/file-upload/file-upload.tsx
  • src/tedi/helpers/hooks/use-file-upload.ts

📝 Walkthrough

Walkthrough

The TEDI FileUpload gains improved accessibility, input reset behavior, focus restoration, live announcements, localized removal messages, and related tests. The Community FileUpload is marked deprecated. Tag roles and FileUpload styling are updated, alongside a TextField selector cleanup.

Changes

FileUpload behavior and deprecation

Layer / File(s) Summary
TEDI FileUpload interaction and accessibility behavior
src/tedi/components/form/file-upload/file-upload.tsx, src/tedi/components/tags/tag/tag.tsx, src/tedi/components/form/file-upload/file-upload.module.scss
FileUpload now wires helper descriptions, restores focus after removal or clearing, exposes failed-file status text, and visually hides the native input with focus styling. Tag accepts an overridable role.
FileUpload announcements and localized labels
src/tedi/helpers/hooks/use-file-upload.ts, src/tedi/providers/label-provider/labels-map.ts
Announcement timing uses managed show/hide timers, input values are reset after changes, and localized removal and cleared messages are added.
FileUpload accessibility and announcement validation
src/tedi/components/form/file-upload/file-upload.spec.tsx
Tests cover accessible descriptions, input clearing, file-specific controls, failed-file announcements, focus restoration, rejection messages, and repeated live-region announcements.
Community FileUpload deprecation metadata
src/community/components/form/file-upload/file-upload.tsx, skills/tedi-react/references/components.md
The Community FileUpload props and documentation identify the component as deprecated and direct imports to the TEDI-Ready path.

TextField selector cleanup

Layer / File(s) Summary
Size-specific TextField selector assignment
src/tedi/components/form/textfield/textfield.module.scss
The size loop now assigns default and modifier selectors through an explicit Sass variable.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FileUpload
  participant useFileUpload
  participant LabelProvider
  User->>FileUpload: Select, remove, or clear files
  FileUpload->>useFileUpload: Handle file interaction
  useFileUpload->>LabelProvider: Resolve localized announcement
  useFileUpload->>FileUpload: Reset input and update announcement
  FileUpload->>User: Expose status and restore focus
Loading

Possibly related issues

Suggested reviewers: mart-sessman, ly-tempel-bitweb

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: re-uploading the same file and accessibility improvements for FileUpload.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/722-fileupload-behavioural-bugs

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...c/tedi/components/form/file-upload/file-upload.tsx 96.15% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@airikej

airikej commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@airikej
airikej requested review from ly-tempel-bitweb and mart-sessman and removed request for ly-tempel-bitweb July 3, 2026 07:46
@airikej

airikej commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/tedi/components/form/file-upload/file-upload.tsx (1)

141-144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Set the exported component’s displayName.

FileUpload is an exported TEDI component but does not assign FileUpload.displayName. Add it after the component declaration.

As per coding guidelines, all exported components in src/tedi/components/**/*.tsx must have a displayName property set.

Suggested addition
+FileUpload.displayName = 'FileUpload';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tedi/components/form/file-upload/file-upload.tsx` around lines 141 - 144,
Set the exported FileUpload component’s displayName immediately after its
component declaration, following the existing naming convention for exported
TEDI components.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/tedi/components/form/file-upload/file-upload.tsx`:
- Around line 141-144: Set the exported FileUpload component’s displayName
immediately after its component declaration, following the existing naming
convention for exported TEDI components.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d5eeed4-b87c-4e85-b894-bb518427263b

📥 Commits

Reviewing files that changed from the base of the PR and between 1e51f4f and b4d6099.

📒 Files selected for processing (7)
  • skills/tedi-react/references/components.md
  • src/community/components/form/file-upload/file-upload.stories.tsx
  • src/community/components/form/file-upload/file-upload.tsx
  • src/tedi/components/form/file-upload/file-upload.spec.tsx
  • src/tedi/components/form/file-upload/file-upload.tsx
  • src/tedi/components/form/textfield/textfield.module.scss
  • src/tedi/helpers/hooks/use-file-upload.ts

@airikej

airikej commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tedi/components/tags/tag/tag.tsx (1)

81-94: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add the missing displayName for Tag.

src/tedi/components/tags/tag/tag.tsx exports Tag but does not set Tag.displayName, which violates the component guideline that exported components must declare a display name.

Proposed fix
 export const Tag = (props: TagProps): JSX.Element => {
   // ...
 };
+
+Tag.displayName = 'Tag';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tedi/components/tags/tag/tag.tsx` around lines 81 - 94, Assign an
explicit display name to the exported Tag component in tag.tsx, using the
component’s existing Tag symbol and the project’s established displayName
convention. Place the assignment alongside the component definition/export
without changing its rendering or props behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tedi/helpers/hooks/use-file-upload.ts`:
- Around line 223-225: Update the success announcement in the file-upload hook
to calculate the added-file count from the newly accepted files, rather than
subtracting actualFiles.length from newFiles.length. Ensure replacing an
existing file with multiple=false announces one added file, while preserving the
existing newFiles.length > 0 guard and announce call.
- Around line 129-136: Update the announce callback to clear the live-region
announcement before scheduling the new message, ensuring repeated identical file
announcements trigger a re-render. Add a React Testing Library regression test
for two identical upload events fired within announcementTimeout and verify both
announcements are delivered.

---

Outside diff comments:
In `@src/tedi/components/tags/tag/tag.tsx`:
- Around line 81-94: Assign an explicit display name to the exported Tag
component in tag.tsx, using the component’s existing Tag symbol and the
project’s established displayName convention. Place the assignment alongside the
component definition/export without changing its rendering or props behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 863b009a-c8b7-4be7-b600-9419de704a57

📥 Commits

Reviewing files that changed from the base of the PR and between b4d6099 and 04ca935.

📒 Files selected for processing (6)
  • src/tedi/components/form/file-upload/file-upload.module.scss
  • src/tedi/components/form/file-upload/file-upload.spec.tsx
  • src/tedi/components/form/file-upload/file-upload.tsx
  • src/tedi/components/tags/tag/tag.tsx
  • src/tedi/helpers/hooks/use-file-upload.ts
  • src/tedi/providers/label-provider/labels-map.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/tedi/components/form/file-upload/file-upload.spec.tsx
  • src/tedi/components/form/file-upload/file-upload.tsx

Comment thread src/tedi/helpers/hooks/use-file-upload.ts Outdated
Comment thread src/tedi/helpers/hooks/use-file-upload.ts
@airikej
airikej merged commit 70ab410 into rc Jul 28, 2026
19 checks passed
@airikej
airikej deleted the fix/722-fileupload-behavioural-bugs branch July 28, 2026 10:15
github-actions Bot pushed a commit that referenced this pull request Jul 28, 2026
# [18.1.0-rc.17](react-18.1.0-rc.16...react-18.1.0-rc.17) (2026-07-28)

### Bug Fixes

* **file-upload:** re-upload same file and A11y improvements [#722](#722) ([#723](#723)) ([70ab410](70ab410))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FileUpload]: Behavioural bugs

2 participants